<?php
	class Article_model extends CI_Model {
	    
    var $id;	
	var $title;	
    var $image;
    var $detail;

    function __construct()
    {
        // Call the Model constructor
        parent::__construct();
    }


    function infos($product_id)
    {
    	$this->db->select('*');
    	$this->db->from('article');
        $this->db->where('product_id',$product_id);

    	$query = $this->db->get();
    	return $query->result();
    }

    function info($id)
    {
        $this->db->select('*');
        $this->db->from('article');
        $this->db->where('id',$id);

        $query = $this->db->get();
        return $query->row();
    }

    function info1($product_id)
    {
        $this->db->select('*');
        $this->db->from('article');
        $this->db->where('product_id',$product_id);
        $this->db->limit(1);

        $query = $this->db->get();
        return $query->row();
    }    

    function insert($data)
    {
        return $this->db->insert('article', $data);
    }
}